#include <iostream>
#include "cppthreadpool.h"
#include "unistd.h"

void func(void* arg)
{
    int num = *(int*)arg;
    printf("thread %ld is working, number= %d\n",pthread_self(),num);
    sleep(1);
}

int main()
{
    cout << "this is test" << endl;
    CppThreadPool* pool = new CppThreadPool(3,10);
    for (size_t i = 0; i < 100; i++)
    {
        int* num = new int;
        *num = i+100;
         pool->addTaskToPool(Task(func, num));
    }
    
    sleep(30);

    return 0;
}